package  com.seecen.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import  com.seecen.pojo.SeekComment;
import com.seecen.pojo.Seeking;
import com.seecen.pojo.User;
import  com.seecen.service.SeekCommentService;
import  com.seecen.mapper.SeekCommentMapper;
import com.seecen.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
* @author zhongsang
* @description 针对表【seek_comment】的数据库操作Service实现
* @createDate 2025-07-27 14:34:09
*/
@Service
public class SeekCommentServiceImpl extends ServiceImpl<SeekCommentMapper, SeekComment>
    implements SeekCommentService{

    @Autowired
    private SeekCommentMapper seekCommentMapper;
    @Override
    public Result getSeekCommentById(Integer id) {
        LambdaQueryWrapper<SeekComment> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SeekComment::getSeekTableId,id);
        List<SeekComment> seekComments = seekCommentMapper.selectList(wrapper);
        return Result.ok(seekComments);
//        SeekComment seekComment1 = new SeekComment();
//        seekComment1.setSeekTableId(seekComment.getSeekCommentId());
//        seekComment1.setVersion(seekComment.getVersion());
//        LambdaQueryWrapper<SeekComment> wrapper = new LambdaQueryWrapper<>();
//        wrapper.eq(SeekComment::getSeekCommentId,seekComment1.getSeekCommentId());
//        seekCommentMapper.update(seekComment1,wrapper);
//        return Result.ok(seekComment);
    }

    @Override
    public Result publishComment(SeekComment seekComment) {
//        int userId = jwtHelper.getUserId(token).intValue();
//
//        headline.setPublisher(userId);
//        headline.setCreateTime(new Date());
//        headline.setUpdateTime((new Date()));
        seekCommentMapper.insert(seekComment);
        return Result.ok(null);
    }
}




